import { request } from '@inbiz/utils';

// 获取流程列表数据接口
export const getProcessList = (params: {
  pageIndex: number;
  pageSize: number;
  orderType: string;
}) => {
  return request('/edoc2Flow-web/process/manageMent/getProcessMonitor', {
    params: {
      ...params,
    },
    timeout: 60000,
  });
};

//获取日志信息
export const getLogInformation = (processInstanceId: string) => {
  return request('/edoc2Flow-web/process/getResults/getProcessLog', {
    params: {
      processInstanceId,
    },
  });
};

//变量接口
export const getVariateListModal = (processInstanceId: string) => {
  return request('/edoc2Flow-web/process/manageMent/getProcessRunVar', {
    params: {
      processInstanceId,
    },
  });
};

//流程详情弹窗
export const getProcessDetailModal = (processInstanceId: string) => {
  return request('/edoc2Flow-web/process/getResults/getProcessDetails', {
    params: {
      processInstanceId,
      inItiateApplication: false,
    },
  });
};

//删除流程接口
export const delProcessList = (processInstanceIds: string) => {
  return request('/edoc2Flow-web/process/manageMent/deleteProcessInstance', {
    params: {
      processInstanceIds,
      forced: true,
    },
  });
};

//查看当前审核人接口
export const getSearchModal = (processInstanceId: string) => {
  return request('/edoc2Flow-web/process/manageMent/getProcessReviewer', {
    params: {
      processInstanceId,
    },
  });
};
//流程指派接口
export const getSelectionMemberModal = (params: {
  delegateUserId: string;
  handelUserId: string;
  taskIds: string;
}) => {
  return request('/edoc2Flow-web/process/operation/processAssignment', {
    method: 'POST',
    data: {
      delegateUserId: params.delegateUserId,
      handelUserId: params.handelUserId,
      taskIds: params.taskIds,
      singleMandate: false,
    },
  });
};

//终止接口
export const getprocessStop = (params: { processInstanceId: string; taskId: string }) => {
  return request('/edoc2Flow-web/process/operation/processStop', {
    method: 'POST',
    data: {
      processInstanceId: params.processInstanceId,
      taskId: params.taskId,
    },
  });
};
